package com.bw.controller;

import com.bw.entity.TbAdm;
import com.bw.entity.TbUserTem;
import com.bw.entity.vo.Admvo;
import com.bw.service.AdmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@SuppressWarnings("all")
public class AdmController {
    @Autowired
    private AdmService admService;
    //用户管理列表
    @RequestMapping("admlist")
    public List<Admvo> admlist(@RequestParam("mohu")String mohu){
        return admService.admlist(mohu);
    }
    //批量删除
    @RequestMapping("del")
    public String  del(@RequestParam("id") String id){
        String[] ids=id.split(",");
        for (String a:ids){
            admService.del(a);
        }
        return "删除成功";
    }
    //添加
    @RequestMapping("admadd")
    public TbUserTem admadd(@RequestBody TbAdm adm){
        return admService.admadd(adm);
    }
    //修改
    @RequestMapping("admupdate")
    public TbAdm admupdate(@RequestBody TbAdm adm){
        return admService.admupdate(adm);
    }
    //回显
    @RequestMapping("findByAdmid")
    public TbAdm findByAdmid(@RequestParam("id")int id){
        return admService.findByAdmid(id);
    }

}
